/**
 * 供应商用户接口
 */
import {
  HTTP
} from '../utils/http.js';
import utils from '../utils/util';

class supplierModel extends HTTP {

  // 登陆
  login(data, sCallback) {
    this.norequest({
      url: 'supplier/app/staff/login',
      method: 'post',
      data: data,
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    })
  }

  // 获取当前供应商信息
  currentSupplierInfo(sCallback) {
    this.request({
      url: 'supplier/app/supplier/currentSupplierInfo',
      method: 'get',
      data: {},
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    })
  }

  // 编辑
  supplierUpdate(data,sCallback) {
    this.request({
      url: 'supplier/app/staff/update',
      method: 'post',
      data: data,
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    })
  }

  // 意见反馈列表查询
  feedbackListPage(data,sCallback,showLoading) {
    this.request({
      url: 'supplier/app/feed/back/listPage',
      method: 'get',
      data: data,
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    },showLoading)
  }
  
  // 查询意见反馈详情
  feedbackFindById(data,sCallback) {
    this.request({
      url: 'supplier/app/feed/back/findById',
      method: 'get',
      data: data,
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    })
  }
  
  // 添加意见反馈
  feedbackAdd(data,sCallback) {
    this.request({
      url: 'supplier/app/feed/back/add',
      method: 'post',
      data: data,
      success: (res) => {
        if(res.code == 200){
          sCallback(res)
        }else{
          utils.msg(res.msg)
        }
      }
    })
  }
  

}
export {
  supplierModel
}